package com.lh.iterator;

import java.util.Iterator;

//计算机学院（数组方式存储）
public class ComputerCollegeIterator implements Iterator {


    //这里我们要知道Department是以怎样的方式存储
    Department[] departments;
    int position = 0; //遍历的位置

    public ComputerCollegeIterator(Department[] departments) {
        this.departments = departments;
    }


    //判断是否还有下一个元素
    @Override
    public boolean hasNext() {

        if (position >= departments.length || departments[position] == null) {
            return false;
        } else {
            return true;
        }


    }

    @Override
    public Object next() {

        Department department = departments[position];
        position += 1;

        return department;
    }

    //删除的方法，默认为空实现
    public void remove(){

    }


}
